home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3262 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. Path: news-feed.mci.newscorp.com!usenet
  2. From: pbe@pobox.com
  3. Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
  4. Subject: Re: C++ with Zapp vs. Delphi
  5. Date: 23 Jan 1996 02:46:41 GMT
  6. Organization: Phoenix Business Enterprises
  7. Message-ID: <4e1i6h$v29@klein.delphi.com>
  8. References: <4coar6$d4n@sun4.bham.ac.uk> <4coip7$69s@news1.usa.pipeline.com> <GK+N9LA3rQAxEwdx@dakal.demon.co.uk>
  9. NNTP-Posting-Host: 206.15.161.89
  10. X-To: Richard Linsley Hood <richardlh@dakal.demon.co.uk>
  11. X-Mailer: SQUID
  12. X-Registration: $737961
  13.  
  14. >The comparison of two objects should be done by themselves, 'are you 
  15. >larger, smaller than this object' thus hiding from the list how this is 
  16. >done. Only an object 'knows' how it compares to another object (of the 
  17. >same type). This is quite reasonably a function of the object.
  18.  
  19. OK here is the Delphi equiv:
  20. (Not complete or syntactically correct, but you'll see my point)
  21.  
  22. Type
  23.      TGenericList = class
  24.           Sort;
  25.           Compare(s1, s2); abstract;
  26.      end;
  27.      TStringList = class
  28.           Compare(s1, s2); override;
  29.      end;
  30.      TPictureList = class
  31.           Compare(s1, s2); override;
  32.      end;
  33.  
  34. procedure TGenericList;
  35. begin
  36.      ...
  37.      If Compare(s1, s2).... (will call DESCENDENT, since they override)
  38.      ...
  39. end;
  40. _
  41. Pennsylvania: Constructionwealth of Pennsylvania
  42.  
  43. +------------------------------------------------------------+
  44. |* Chad Z. Hower  -  phoenix@pobox.com                       |
  45. |* Consultant - Phoenix Business Enterprises                 |
  46. |         pbe@pobox.com   -   http://pobox.com/~pbe          |
  47. |* Principal Analyst Programmer -                            |
  48. |         SCB Computer Technology Inc - czhower@eastman.com  |
  49. |Physically in Church Hill, TN - Logically Not Sure          |
  50. |     **** My Opinions are my own, I don't steal them ****   |
  51. +------------------------------------------------------------+
  52. >>SQUID - The ultimate database reader, and NO limits. #$737961
  53. **Special Compile: 1.033B (Beta)
  54.